Socket
Socket
Sign inDemoInstall

random-access-memory

Package Overview
Dependencies
Maintainers
1
Versions
22
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

random-access-memory

Exposes the same interface as random-access-file but instead of writing/reading data to a file it maintains it in memory


Version published
Weekly downloads
5K
decreased by-49.14%
Maintainers
1
Weekly downloads
 
Created
Source

random-access-memory

Exposes the same interface as random-access-file but instead of writing/reading data to a file it maintains it in memory. This is useful when running tests where you don't want to write files to disk.

npm install random-access-memory

Usage

var ram = require('random-access-memory')
var file = ram()

file.write(0, Buffer.from('hello'), function () {
  file.write(5, Buffer.from(' world'), function () {
    file.read(0, 11, console.log) // returns Buffer(hello world)
  })
})

You can also initialize a ram instance with a Buffer:

var file = ram(Buffer.from('hello world'))

License

MIT

FAQs

Package last updated on 16 Nov 2021

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc